Skip to main content

All Questions

Tagged with
4votes
1answer
163views

Simple Sieve of Eratosthenes

I've implemented this version of the Sieve of Eratosthenes in Rust, with inputs. I'm mostly pleased with it, but want to know if the input logic can be simplified, and if the sieve itself can be ...
Vessel's user avatar
10votes
1answer
311views

Construct a performant sieve of Atkin in Rust

I have implemented the sieve of Atkin in Rust. It can find all primes till 1,000,000,000 in 4.5 s using 34.4 MiB on my 1.4 GHz machine. This is a direct implementation (with some optimisations made ...
tfpf's user avatar
  • 203
3votes
1answer
147views

Hunting for the 100,001st prime in Rust

Most of my programming experience is in Python, but my first language was C, and I was intrigued by the combination which Rust offers: a streamlined syntax and no manual memory management, but with ...
Tom Hosker's user avatar
3votes
1answer
138views

Prime sieve in Rust

Using Sieve of Eratosthenes, I created a function that returns a vector of primes up to given limit. ...
manungsa's user avatar
3votes
1answer
221views

Find factor pairs of an integer in Rust

I'm trying to efficiently generate all pairs of factors of a number n. For example, when n=27, the factor pairs are (1, 27), (3, 9), (9, 3), (27, 1) The order in which the pairs are found is not ...
Bram's user avatar
2votes
1answer
130views

Multithreaded segmented Sieve of Eratosthenes

I am fairly new to Rust and thought a good way to practice would be to write a multithreaded segmented Sieve of Eratosthenes. It performs ok (searches ten-billion numbers in about 11 seconds on my ...
knots427's user avatar
4votes
2answers
210views

Project Euler #51: "Prime digit replacements" in Rust

Problem: https://projecteuler.net/problem=51 "Find the smallest prime which, by replacing part of the number (not necessarily adjacent digits) with the same digit, is part of an eight prime ...
sarema's user avatar
3votes
2answers
233views

Generating prime numbers quickly in rust

I am attempting to re-implement a postponed sieve algorithm for generating prime numbers in Rust. I am able to make a solution that works, but I have to use a couple of ...
kbrose's user avatar
0votes
1answer
46views

Function returning a vec with prime factors of number

See code below and my comment with questions: ...
Antonin GAVREL's user avatar
7votes
2answers
521views

Calculate all the prime numbers between two given numbers

I've made an application that calculates all the prime numbers between two given numbers and prints then into a .txt document... anything I can improve? ...
AUniquee's user avatar
5votes
1answer
242views

Largest Prime factor (Project Euler in Rust)

I've been working on my Rust a bit and want to know how idiomatic my rust code is for the following Project Euler problem: ...
TheStrangeQuark's user avatar
4votes
1answer
88views

Rust version of basic functional prime stream - can this be made less clunky?

I'm looking at implementing the basic functional not-quite-Eratosthenes prime stream in Rust. I like to try it when I start learning a language. Here's the bog standard Haskell version: ...
lab27's user avatar
7votes
1answer
2kviews

A Rust crate with both `main.rs` and `lib.rs` performing primality checking

Introduction I decided to get my feet wet in Rust by going ahead an implementing a full crate with the tests, documentation, and all other accompanying stuff. This is a toy implementation of a ...
Hungry Blue Dev's user avatar
3votes
2answers
2kviews

Sieve of Eratosthenes in Rust

This is a relatively simple implementation of the Sieve of Eratosthenes in Rust. The main objective is to find the \$n\$th prime quickly when \$n\$ might grow to huge numbers. ...
Hungry Blue Dev's user avatar
2votes
1answer
1kviews

Rust nth prime implementation

I have implemented an nth prime algorithm in Rust that uses value lookup for n < 6, trial division for n < 1000, and a sieve function for n > 999. How can it be better optimized? ...
stevensonmt's user avatar

153050per page
close